//
//  DeleteImageCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/23.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "DeleteImageCell.h"

@implementation DeleteImageCell{
    UIButton    *deleteBtn;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        self.imageV=[[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV];
        [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(5, 5, 5, 5));
        }];
        
        deleteBtn=[[UIButton alloc]init];
        [deleteBtn setImage:[UIImage imageNamed:@"delete_pic"] forState:UIControlStateNormal];
        [deleteBtn addTarget:self action:@selector(onclickDelete) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:deleteBtn];
        [deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.imageV.mas_right);
            make.centerY.equalTo(self.imageV.mas_top);
            make.size.mas_equalTo(CGSizeMake(10, 10));
        }];
    }
    return self;
}

- (void)onclickDelete{
    if (self.deleteBlock) {
        self.deleteBlock();
    }
}
@end
